<template>
  <div class="step-container">
    <el-form ref="form" label-width="120px" class="base-info">
      <el-form-item label="单位名称:"> {{ formData.unitName }} </el-form-item>
      <el-form-item label="注册地址"> {{ formData.unitAddress }} </el-form-item>
      <el-form-item label="邮寄地址:"> {{ formData.address }} </el-form-item>
      <el-form-item label="邮政编码:">
        {{ formData.unitPostCode }}
      </el-form-item>
      <el-form-item label="联系电话:"> {{ formData.unitTel }} </el-form-item>
      <el-form-item label="成立时间:">
        {{ formData.unitEstTime }}
      </el-form-item>
      <el-form-item label="营业执照注册号:">
        {{ formData.creditCode }}
      </el-form-item>
      <el-form-item label="发证机关:"> {{ formData.fzjg }} </el-form-item>
      <el-form-item label="法定代表人:"> {{ formData.fddbrXm }} </el-form-item>
    </el-form>
  </div>
</template>
<script>
import userApi from '@/api/user';
import { decrypt } from '@/utils/sms4util';
export default {
  props: {
    id: {
      type: String,
    },
  },
  data() {
    return {
      formData: {},
    };
  },
  computed: {
    userId() {
      return this.$store.state.user.userInfo.id;
    },
  },
  mounted() {
    this.init();
  },
  methods: {
    async init() {
      this.$emit('loading', true);
      let params = {
        id: this.id || this.userId,
        // 企业用户
        type: 2,
      };
      const res = await userApi.getUserInfo(params).finally(() => {
        this.$emit('loading', false);
      });
      this.formData = {
        ...this.formData,
        ...res,
        unitTel: res.unitTel ? decrypt(res.unitTel) : '',
        creditCode: res.creditCode ? decrypt(res.creditCode) : '',
        ...res.sysUnitQua,
      };
    },
  },
};
</script>
<style lang="scss" scoped>
.step-container {
  margin-top: 90px;
  width: 100%;
  padding: 20px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  .form-main {
    margin-top: 30px;
    width: 100%;
    .form-line {
      margin-top: 24px;
      width: 100%;
      display: flex;
      justify-content: center;
      line-height: 40px;
      .text1 {
        width: 160px;
        text-align: right;
      }
      .text2 {
        margin: 0px 30px;
      }
      .text4 {
        margin: 0px 20px;
      }
      .text5 {
        margin-left: 40px;
        margin-right: 20px;
      }
      .code {
        width: 60px;
      }
      .datePicker {
        width: 160px;
      }
    }
  }
}
</style>
